package com.panopset.flywheel;

import java.io.StringWriter;
import java.util.Vector;

/**
 * Any command that is after burner processed with the QuitCommand must
 * extend this class.
 *
 * @author Karl Dinwiddie
 *
 */
public abstract class MatchableCommand extends TemplateDirectiveCommand {
    public final Vector<Command> commands = new Vector<Command>();
    protected CommandQuit commandQuit;

    public MatchableCommand(String source, String innerPiece, Template template) {
        super(source, innerPiece, template);
    }

    @Override
    public void resolve(StringWriter sw) {
        for (Command command : commands) {
            if (template.flywheel.isStopped()) {
                return;
            }
           command.resolveCommand(sw);
        }
    }

}
